package entity;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Option extends BaseEntity{
	private String letter;
	private String description;
	private Object obj;
	private String methodName;
	
	public Option(String letter, String description, Object obj, String mName) {
		this.setLetter(letter);
		this.setDescription(description);
		this.setObject(obj);
		this.setMethodName(mName);
	}

	private void setMethodName(String str) {
		this.methodName=str;
	}

	private void setObject(Object object) {
		this.obj=object;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getLetter() {
		return letter;
	}

	public void setLetter(String letter) {
		this.letter = letter;
	}
	
	public void run() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
		Class<?> c=obj.getClass();
		Method m=c.getDeclaredMethod(this.methodName);
		m.invoke(this.obj);
	}

}
